package com.dongqi.myblog.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dongqi.myblog.po.TBlog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dongqi.myblog.po.vo.BlogQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author dongqi
 * @since 2020-08-03
 */
public interface TBlogMapper extends BaseMapper<TBlog> {

    /**
     * 链表分页查询blog
     * @param page
     * @param wrapper
     * @return
     */
    List<BlogQuery> listBlogs(Page<BlogQuery> page, @Param(Constants.WRAPPER)Wrapper wrapper);

    List<BlogQuery> listIndex(Page<BlogQuery> page, @Param(Constants.WRAPPER)Wrapper wrapper);

    TBlog selectBlog(Long id);

    List<TBlog> blogsByTag(Page<TBlog> page,@Param("tagId") Long tagId);

    List<String> findGroupYear();

    List<TBlog> findBlogByYear(String year);

    Long countBlog();
}
